package com.itheima.app.interceptor;

//ThreadLocal，用于存储token获得的user对象

import com.itheima.domain.db.User;

public class UserHolder {

    private static final ThreadLocal<User> TL = new ThreadLocal<User>();

    //向线程内存储user
    public static void set(User user){
        TL.set(user);
    }

    //从线程内获取user
    public static User get(){
        return TL.get();
    }
    //删除线程内的user
    public static void remove(){
        TL.remove();
    }
}
